#include <iostream>
#include <string.h>
using namespace std;
class MyString{
    private: char* buffer;
    public:
        MyString(const char* initString){
            if (initString!=NULL){
                buffer=new char[strlen(initString)+1];
                strcpy(buffer,initString);
            }
        }
        ~MyString(){
            if (buffer!=NULL){
                delete[] buffer;
                cout<<"free pointer"<<endl;
            }
        } 
        int GetLength(){
            return strlen(buffer);
        }
        const char*  GetString(){
            return buffer;
        }
};
int main(){
    MyString sayHello("hello world!");
    cout<<"buffer length="<<sayHello.GetLength()<<endl;
    cout<<"buffer content="<<sayHello.GetString()<<endl;
    return 0;
}
